<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>倒计时</title>
    <!-- <link rel="stylesheet" type="text/css" href="./../../css/video.css" /> -->
    <style>
        body,
        html {
            height: 0px;
        }

        .center {
            background-color: rgba(129, 129, 128, 0.7);
            text-align: center;
            border-radius: 20px;
            color: #fff;
            /*position: fixed;*/
            bottom: 50%;
            right: 50%;
            margin-top: -8px;
            margin-left: -7px;
            display: inline-block;
            padding: 5px 10px;
        }

        .img_wjt {
            width: 10px;
            display: inline-block;
        }

        .img_pro {
            position: absolute;
            bottom: 27px;
            padding: 0px 15px;
            height: 10px;
            width: 100%;
        }

        .daojishi {
            font-size: 14px;
            margin-right: 8px;
            position: relative;
        }

        .daojishi::after {
            position: absolute;
            content: "";
            top: 0px;
            height: 15px;
            width: 1px;
            left: 21px;
            background: #fff;
        }
    </style>
</head>

<body>
    <div id="vm">
        <div class="center" @click="guanbiguanggao()">
            <span class="daojishi">{{daojishi2}}</span>
            <span style="color:#FFBA14;font-size:14px;">关闭广告</span>
        </div>
    </div>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/config.js"></script>
<script type="text/javascript" src="../../script/rest.js"></script>
<script type="text/javascript" src="../../script/vue.2.5.js"></script>
<script type="text/javascript" src="../../script/faskclick.js"></script>
<script type="text/javascript">
    var uid = $api.getStorage('uid')
    var vm = new Vue({
        el: '#vm',
        data: {
            daojishi: 30,
            daojishi2: 30,
            isvip: false
        },
        created: function() {
            var _this = this;
            apiready = function() {
                _this.init();
                api.parseTapmode();
                if ('addEventListener' in document) {
                    document.addEventListener('DOMContentLoaded', function() {
                        FastClick.attach(document.body);
                    }, false);
                }
                api.addEventListener({
                    name: 'settimedaojishi'
                }, function(ret, err) {
                    if (ret.value.falg==1) {
                      _this.daojishi2 = ret.value.daojishi
                    }else {
                      _this.daojishi2 = ret.value.daojishi
                       _this.liuliang()
                    }
                });

            }
        },
        methods: {
            init: function() {
                var _this = this;
                if (uid) {
                  new rest().get('getUserInfo').datae({
                      uid: uid
                  }).success(function(res) {
                      if (res.msg[0].level == 1) {
                          _this.isvip = true
                      }
                  }).error(function(err) {
                      console.log(JSON.stringify(err))
                  }).run()
                }
            },
            liuliang: function() {
                api.sendEvent({
                    name: 'guanbidaojishi'
                });
                api.closeFrame();
            },
            guanbiguanggao: function() {
                if (this.isvip) {
                    api.sendEvent({
                        name: 'guanbidaojishi'
                    });
                    api.closeFrame();
                } else {
                    // api.toast({
                    //     msg: '会员可以关闭',
                    //     duration: 2000,
                    //     location: 'bottom'
                    // });
                    api.sendEvent({
                        name: 'zantingvideoad'
                    });
                    api.openWin({
                        name: 'unbuy_vip_win',
                        url: '../VIP/unbuy_vip_win.html',
                        pageParam: {
                          value:1
                        }
                    });
                }
            }
        }
    })
</script>

</html>
